import os
import re
import time

eMuleDir = 'd:\eMuleDownload'

while True:
    downloadDone = True
    filelist = os.listdir(eMuleDir)
    
    for file in filelist:
        #print(file)
        tmp = re.match('.*\.rmvb\.part$', file)
        if tmp is not None:
            print(file)
            downloadDone = False
        
    if downloadDone is True:
        print('Shutdown the computer in two minutes ...')
        os.system('taskkill /im emule.exe')
        os.system('shutdown -s -t 120')
    else:
        print('Sleep ...')
        time.sleep(60 * 5)